# coding:utf-8
'''
	复制模型模块
	汉中库得网络科技
	电子信箱：yyc1030@qq.com
'''
from PySide2 import QtGui
from PySide2 import QtWidgets
from pymxs import runtime as rt
import os

class CopyModelAction(QtWidgets.QAction):
	
	def __init__(self, app):
		icon = QtGui.QIcon(app.rootPath + "/icon/copy_model.png")
		self.app = app
		super(CopyModelAction, self).__init__(icon, "复制模型", app.mainWindow)
		self.triggered.connect(self.copyModel)
		
	def copyModel(self):
		if not os.path.exists("C:/Users/Public/temp"):
			os.makedirs("C:/Users/Public/temp")
		if len(rt.selection):
			rt.saveNodes(rt.selection, "C:/Users/Public/temp/diy_copy.max")